<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="JS/jquery-1.11.1.min.js">

    </script>
</head>
<body>
    <button onclick="gogo()" >发ajax请求</button>
        <table id="tb" border="1px" width="80%">
            <tr>
                <td>id</td>
                <td>姓名</td>
                <td>地址</td>
                <td>年龄</td>
            </tr>
        </table>

</body>
<script>
    var  url="http://localhost:8080/taobao/json";
    function gogo() {
        alert("成功发送请求");
        $.ajax({
            url: url,
            type: "POST",
            dataType: "JSON",
            success: function (result) {
               console.log(result);
               show(result);
            },
            error:function (){
                alert("出错");
            }
        })
    }
    function show(data){
        var tb=document.querySelector("#tb");
        for(var i=0;i<data.length;i++){
            var tr=tb.insertRow();
            var td=tr.insertCell();
            td.innerText=data[i].stuid;
            var td1=tr.insertCell();
            td1.innerText=data[i].name;
            var td2=tr.insertCell();
            td2.innerText=data[i].address;
            var td3=tr.insertCell();
            td3.innerText=data[i].age;

        }
    }
    /*
    *  url:url,
            type:"POST",
            dataType:"JSON",
            success:function(result) {
                console.log(result);
                $("#s").html(result);
                var ok=JSON.stringify(result);
                //

            },
            error:function (){
                $("#s").html("请求失败");
            },
    * */
</script>
</html>